int sumOddLengthSubarrays(int* arr, int arrSize)
{
    int sum = 0;
    for (int i = 0; i < arrSize; i++)
    {
        int n = (arrSize - i) % 2 == 0 ? (arrSize - i) - 1 : arrSize - i;
        for (int size = 1; size <= n; size += 2)
        {
            int subarraySum = 0;
            for (int j = 0; j < size; j++)
            {
                subarraySum += arr[i + j];
            }
            sum += subarraySum;
        }
    }
    return sum;
}
#include <iostream>

int main() {
    int arr[] = {1, 4, 2, 5, 3};
    int arrSize = sizeof(arr) / sizeof(arr[0]);

    int result = sumOddLengthSubarrays(arr, arrSize);

    std::cout << "Sum of odd length subarrays: " << result << std::endl;

    return 0;
}